/*
SMINT V1.0 by Robert McCracken
SMINT is my first dabble into jQuery plugins!
http://www.outyear.co.uk/smint/
If you like Smint, or have suggestions on how it could be improved, send me a tweet @rabmyself
*/
(function(){
	$.fn.smint = function( options ) {
		$(this).addClass('smint')
		var settings = $.extend({
            'scrollSpeed '  : 500,
			'offTop '  : 500
            }, options);
		return $('.smint a').each( function() {
			if ( settings.scrollSpeed ) {
				var scrollSpeed = settings.scrollSpeed
			}
			var stickyTop = $('.smint').offset().top;
			var stickyMenu = function(){
				var scrollTop = $(window).scrollTop();
				//console.log('settings.offTop:'+options.offTop+',scrollTop:'+scrollTop);
				if (scrollTop > options.offTop) {
					$('.smint').css({ 'position': 'fixed', 'top':0 }).addClass('fixed');
					} else {
						$('.smint').css({ 'position': 'relative', 'top':0 }).removeClass('fixed');
					}   
			};
			stickyMenu();
			$(window).scroll(function() {
				 stickyMenu();
			});
            //$(this).on('click', function(e){
			//	var selectorHeight = $('.smint').height();
			//	e.preventDefault();
		 	//	var id = $(this).attr('id');
			//	var goTo =  $('div.'+ id).offset().top -selectorHeight;
			//	$("html, body").animate({ scrollTop: goTo }, scrollSpeed);
			//});
		});
	}
})();
